#ifndef _COND_HPP_
#define _COND_HPP_

#include "Mutex.hpp"

namespace Condition
{
    class Cond
    {
        public:
            Cond()
            {
                pthread_cond_init(&_cond,nullptr);
            }
            ~Cond()
            {
                pthread_cond_destroy(&_cond);
            }
            void Wait(Mutex &mutex)
            {
                int n = pthread_cond_wait(&_cond,mutex.GetMutex());
                (void) n;
            }
            void Signal()
            {
                int n = pthread_cond_signal(&_cond);
                (void) n;
            }
            void Broadcast()
            {
                int n = pthread_cond_broadcast(&_cond);
                (void) n;
            }
        private:
            pthread_cond_t _cond;
    };
}

#endif